Process the result of refreshing the folder during autocompletion
authorFederico Mena Quintero <federico@novell.com>
Fri, 23 Jan 2009 00:54:08 +0000 (00:54 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Fri, 23 Jan 2009 00:54:08 +0000 (00:54 +0000)
(start_autocompletion): Process the result from refresh...().  We
only do completion in the REFRESH_OK case.  For the error cases,
we don't do anything, as this is autocompletion and must not
result in non-asked-for errors popping up.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
svn path=/trunk/; revision=22180

ChangeLog
gtk/gtkfilechooserentry.c

index 5302759f95ab06e1c727691fe902c5c50c5f865b..bcbfc4b92610093d8a1f20f9b8b22200a3f948fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        (commit_completion_and_refresh): Don't do anything with the result
        of refresh...(), since this function doesn't get called during
        completion-related interaction.
+       (start_autocompletion): Process the result from refresh...().  We
+       only do completion in the REFRESH_OK case.  For the error cases,
+       we don't do anything, as this is autocompletion and must not
+       result in non-asked-for errors popping up.
        
 2009-01-22  Matthew Barnes  <mbarnes@redhat.com>
 
index 30dcb61385ce4fe6515b273ec48bf54106206e8d..de6adea7f75b2baf6af05fc36298a4a9d450c3aa 100644 (file)
@@ -1584,21 +1584,34 @@ autocomplete (GtkFileChooserEntry *chooser_entry)
 static void
 start_autocompletion (GtkFileChooserEntry *chooser_entry)
 {
-  /* FMQ: get result from the function below */
-  refresh_current_folder_and_file_part (chooser_entry, REFRESH_UP_TO_CURSOR_POSITION);
+  RefreshStatus status;
+
+  status = refresh_current_folder_and_file_part (chooser_entry, REFRESH_UP_TO_CURSOR_POSITION);
 
-  if (!chooser_entry->current_folder)
+  switch (status)
     {
+    case REFRESH_OK:
+      g_assert (chooser_entry->current_folder_file != NULL);
+
+      if (chooser_entry->current_folder && _gtk_folder_is_finished_loading (chooser_entry->current_folder))
+       autocomplete (chooser_entry);
+      else
+       chooser_entry->load_complete_action = LOAD_COMPLETE_AUTOCOMPLETE;
+
+      break;
+
+    case REFRESH_INVALID_INPUT:
+    case REFRESH_INCOMPLETE_HOSTNAME:
+    case REFRESH_NONEXISTENT:
+    case REFRESH_NOT_LOCAL:
       /* We don't beep or anything, since this is autocompletion - the user
        * didn't request any action explicitly.
        */
-      return;
-    }
+      break;
 
-  if (_gtk_folder_is_finished_loading (chooser_entry->current_folder))
-    autocomplete (chooser_entry);
-  else
-    chooser_entry->load_complete_action = LOAD_COMPLETE_AUTOCOMPLETE;
+    default:
+      g_assert_not_reached ();
+    }
 }
 
 static gboolean